/*
 * Copyright (c) 2005, 2014 vacoor
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 */

package org.ponly.cta4j.service;

import java.awt.image.BufferedImage;
import java.util.Locale;

/**
 * 验证码服务.
 */
public interface CaptchaService {

    /**
     * Method to retrieve the challenge corresponding to the given ticket.
     *
     * @param id ticket
     * @return the challenge
     */
    BufferedImage getChallengeForId(final String id);

    /**
     * Method to retrieve the challenge corresponding to the given ticket.
     *
     * @param id ticket
     * @param locale the desired localized captcha
     * @return the localized challenge
     */
    BufferedImage getChallengeForId(final String id, final Locale locale);

    /**
     * Method to validate a response to the challenge corresponding to the given ticket.
     *
     * @param id ticket
     * @return true if the response is correct, false otherwise.
     */
    boolean validateResponseForId(final String id, final Object response);

}
